package cn.collin.commons.web.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

/**
 * 用于解决在ie浏览器下cookie跨域安全限制的问题，如iframe中调用其他域名下的页面
 * 
 * @author collin.code@gmail.com
 * 
 */
public class P3PFilter implements Filter {

	public void destroy() {
		// do nothing

	}

	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		chain.doFilter(request, response);
		HttpServletResponse hresponse = (HttpServletResponse) response;
		hresponse.setHeader("P3P", "CP=CAO PSA OUR");
	}

	public void init(FilterConfig arg0) throws ServletException {
		// do nothing

	}

}
